<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="com.wonders.ips.common.DoText"%>
<%@ page import="com.wonders.ips.sysadmin.Template"%>

<%
String sTP_id = request.getParameter("TP_id");
int iTP_id ;
if (sTP_id != null) {
  iTP_id = Integer.parseInt(sTP_id);
}
else {
  iTP_id = 0;
}

DoText oDoText = new DoText();

String s_name = request.getParameter("name");
s_name = oDoText.replace(s_name,"'","''");

String s_content = request.getParameter("content");
String s_flag = request.getParameter("flag");

Template oTemplate = new Template();

if (iTP_id == 0) {
  oTemplate.add(s_name, s_content, s_flag);
}
else {
  String sActionType = request.getParameter("actionType");
  if (sActionType.equals("1")) {
    oTemplate.mod(iTP_id, s_name, s_content, s_flag);
  }
  else {
    oTemplate.del(iTP_id);
  }
}
response.sendRedirect("list_template.jsp?flag="+s_flag);
%>
